package com.library.controller.user;

import com.library.pojo.Result;
import com.library.pojo.User;
import com.library.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

@RestController("userUser")
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 根据id查询用户
     */
    @GetMapping
    public Result getById(){
        User user = userService.getUserId();
        return Result.success(user);
    }
    /**
     * 修改用户
     */
    @PutMapping("/update")
    public Result update(@RequestBody User user){
        userService.update(user);
        return Result.success();
    }
}
